home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / gfx / 3d / irit50src.lha / irit5 / scripts / ambiguit.irt < prev    next >
Encoding:
Text File  |  1993-12-30  |  825 b   |  40 lines

  1. #
  2. # The most common example of wireframe ambiguity. See for example:
  3. # Geometric Modeling by Michael E. Mortenson, page 4...
  4. #
  5.  
  6. save_res = resolution;
  7. save_view = view_mat;
  8.  
  9. view_mat = view_mat * scale(vector(0.6, 0.6, 0.6)) * rotx(30) * roty(20);
  10.  
  11. A = box(vector(-0.5, -0.5, -0.55), 1.0, 1.0, 1.1);
  12.  
  13. resolution = 4;            # To create 4 sided pyramids from cones...
  14. C1 = cone(vector(0.0, 0.0, -0.6), vector(0.0, 0.0,  0.6), 0.6 * sqrt(2.0)) *
  15.     rotz(45);
  16. C2 = cone(vector(0.0, 0.0,  0.6), vector(0.0, 0.0, -0.6), 0.6 * sqrt(2.0)) *
  17.     rotz(45);
  18.  
  19. A = A - C1 - C2;
  20. free(C1);
  21. free(C2);
  22. view(list(view_mat, A), on);
  23.  
  24. B = box(vector(-0.3, -0.3, -1.0), 0.6, 0.6, 2.0);
  25. C = A - B;
  26. free(A);
  27. free(B);
  28.  
  29. final = convex(C);
  30. free(C);
  31.  
  32. beep();
  33. interact(final);
  34.  
  35. save("ambiguit", final);
  36. free(final);
  37.  
  38. view_mat = save_view;
  39. resolution = save_res;
  40.